#ifndef __THREAD_POOL__
#define __THREAD_POOL__
#include <my_header.h>
#include "tidArr.h"
#include "taskQueue.h"
#include <syslog.h>
#include"login.h"
extern char base_addr[200];
typedef struct threadPool_s {
    // 子线程的信息 
    tidArr_t tidArr;
    // 任务队列
    taskQueue_t taskQueue;
    // 锁
    pthread_mutex_t mutex;
    // 条件变量
    pthread_cond_t cond;
    // 退出标志
    int exitFlag;
} threadPool_t;

typedef struct train_s {
  int length;
     char data[1000];
 } train_t;//客户端和服务端协议设计要一致
int threadPoolInit(threadPool_t *pthreadPool,int workerNum);
int makeWorker(threadPool_t *pthreadPool);
int tcpInit(char *ip, char *port);
int epollAdd(int epfd, int fd);
int epollDel(int epfd, int fd);


int recvCommandPacket(int netfd,int *cmd,int *length,char *addr);
int cdFunc(char*path,int addr_size,char *now_addr);
int lsFunc(char *now_addr,char* path,int path_size,char* buf);
int pathSeparation(char*path,char**spath,int *size);

//addr:now_addr
int split_str(const char*addr,char ***segment);//从地址提取字符串
int pwdFunc(const char *addr,char *buf);
int mkdirFunc(const char *now_addr,const char* dir_name);
int rmdirFunc(const char *now_addr,const char *dir_name);



int recvn(int sockfd, void *buf, ssize_t length);
int putsFunc(int sockfd,char *filename);
int getsFunc(int sockfd,char *filename);
//int remFunc(const char *now_addr,char *filename);

#endif
